/**
 * problem_043.cpp
 * Copyright (C) 2011 - xrose
 */

#include <iostream>
#include <stdio.h>
using namespace std;

int pal[10] = {0};

int isDifdigit(int abc)
{
	int c;
	//cout<<"isDifdigit_abc = "<<abc<<endl;
	while(abc>0)
	{
		c = abc%10;
		if(pal[c]==0)
		{
			pal[c]=1;
			abc = abc/10;
		}else
			return 0;
	}
	return 1;
}
int truncFirst2(int abc) //abc -> ab
{
    return abc/10;
}
int addLast1(int abc)    //abc->ab->dab
{
    int ab = abc/10;
    for(int i=9; i>=0; i--)
    {
        if(pal[i]==0)
        {
            pal[i]=1;
            return i*100+ab;
        }
    }
    return 0;
}

int resetPal(int *ptr, int l)
{
    for(int i=0; i<l; i++)
        *(ptr+i) = 0;
    return 1;
}

int main (int argc, char const* argv[])
{
	cout<<isDifdigit(10)<<endl;
	for(int abc = 17; abc< 987; abc+=17 )
	{
	    resetPal(pal, 10);
        if(isDifdigit(abc))
        {
            cout<<"test"<<abc<<endl;
        }
	}
	return 0;
}
